﻿using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Transactions;
using Newtonsoft.Json;
using System.Reflection;
using System.Data;
using T.ServiceComponent.DAC.Service;
using T.ServiceComponent.DataAccessEx.Core;
using T.FAS.Runtime.Base.Entity;

namespace T.FAS.Runtime.Base.Dao
{
    public class QueryPlanDetailDao : DaoService<QueryPlanDetail>
    {
        public override string TableName => "FAS_QueryPlanDetail";
        public override string IDColumnName => "ID";
        public QueryPlanDetailDao() : base()
        {
            DBName = "TFAS";
        }
        public override List<string> ExceptColumnName => new List<string> { "IsAuth" };
        public override Dictionary<string, object> GetDataMapping(QueryPlanDetail data)
        {
            var datas = base.GetDataMapping(data);
            return datas;
        }
        public override QueryPlanDetail ConvertToObject(Dictionary<string, PropertyInfo> columns, DataRow row)
        {
            var myCol = new Dictionary<string, PropertyInfo>(base.Columns);
            var data = base.ConvertToObject(myCol, row);
            return data;
        }
        /// <summary>
        /// 修改预警ID
        /// </summary>
        public void UpdateWaringID(string contentID, string warningID)
        {
            List<IDbDataParameter> paramList = new List<IDbDataParameter>();
            paramList.Add(DB.MakeInParam("@contentID", TDbDataType.VarChar, contentID));
            paramList.Add(DB.MakeInParam("@warningID", TDbDataType.VarChar, warningID));
            var sql = $"update {TableName} set WarningID=@warningID Where ID=@contentID;";
            DB.ExecSqlStatement(sql,paramList.ToArray());
        }
    }
}
